________________________________________________________________________ Chapter 1: What's Really Happening 5 ________________________________________________________________________ CHAPTER ONE: WHAT'S REALLY HAPPENING? Until now, you may have only used HyperPAD and its applications (the pads) to simplify your computing environment. Pad users do not necessarily need to understand the inner workings of HyperPAD. They just type into fields and push buttons. As a pad author, you will explore the internal workings of the Browser and learn to control your applications by writing scripts using the PADtalk scripting language. You will also be introduced to the message passing system which controls execution of these scripts. Let's take a quick look at a pad from an authoring perspective. Each pad is made up of a number of screens which the user interacts with by pressing keys, moving the mouse, and clicking mouse buttons. Each of these user-initiated events is translated into a message and sent to the objects that make up HyperPAD. For example, if you select a button by pressing ENTER, the select message is sent to that button. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ **** The Printed Documentation has a picture or screen shot here **** ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ________________________________________________________________________ Chapter 1: What's Really Happening 6 ________________________________________________________________________ When an object receives a message, one of two things will occur. The object will either ignore the message because you haven't defined any actions to be executed when that message is received, or the object will execute preassigned actions. As you will learn, an object only performs actions defined in its script. WHAT IS PADTALK? As a pad author, you will use PADtalk scripts to define the actions that occur when objects receive certain messages. For example, when the Home button is selected by pressing ENTER, the select message is sent to the Home button, telling it that it has been selected. Since the button's script understands this message, the statements in the script are executed and the Home pad is opened and displayed. You will create your scripts using the HyperPAD language called PADtalk. Unlike most programming languages, it is understandable and English- like. Even non-programmers can understand and use PADtalk. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ **** The Printed Documentation has a picture or screen shot here **** ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ________________________________________________________________________ Chapter 1: What's Really Happening 7 ________________________________________________________________________ WHAT DO YOU USE IT FOR? Some general types of applications you can create with PADtalk and HyperPAD are: 0 PC interfaces for launching DOS and Windows programs 0 Customized DOS shells for managing files and directories 0 Interactive computer-based training systems 0 Information bases 0 Software prototypes 0 Front ends for corporate information systems In order to create your own applications using PADtalk, you must understand objects, their relationship to each other, message passing, and the object hierarchy. Therefore, it is very important to understand the material in this chapter and the two chapters that follow: "PADtalk Scripts" and "The Object Hierarchy." Before exploring the object hierarchy, we will discuss the family of HyperPAD objects and introduce you to its members. OBJECTS Generally, an object is something that receives and responds to messages. All HyperPAD objects have properties that allow you to modify their visual appearance and behavior. You can alter the properties of objects, including object scripts, with the Info dialog boxes accessible through the Objects menu. Buttons, fields, pages, backgrounds, pads and even HyperPAD itself are objects, receiving and passing messages. Messages travel between objects along a predetermined path called the object hierarchy. Below, we will discuss the objects, the hierarchy into which they're arranged and the HyperPAD environment. PAD The word "pad" is an acronym for Personal Application Design. Pads are the basic HyperPAD file structure. All applications designed with HyperPAD, several dozen of which came in your package, are pads. Each pad is made up of at least one background and one page. ________________________________________________________________________ Chapter 1: What's Really Happening 8 ________________________________________________________________________ BACKGROUND Backgrounds contain those elements (buttons, fields, text, and paint) that recur on numerous pages throughout the pad. For example, if you want your pad's users to be able to quit from every page in your pad, you may place a Quit button on the background(s) in that pad. Backgrounds can also serve as templates for pads, defining where information is placed and what the pad looks like, since each page is overlaid on top of a background. PAGE Pages form the bulk of a pad and in general display the pad's information. Pages contain elements (text, paint, buttons, and fields) that are unique to that page. Furthermore, pages contain all the text from both background and page fields. FIELD A field is a container used to display or retrieve textual information. Although each field is placed on its own transparent layer, it "belongs" to either a page or a background. Regardless of where the field is located, the information it holds is always stored on the page. BUTTON Buttons are objects that respond to user input by executing some pre- defined action(s). Each button is placed on its own layer, which belongs to either a page or a background. OTHER HYPERPAD OBJECTS HyperPAD also contains the following objects: menu bar, status bar, message box and tool box. HOW TO REFER TO OBJECTS When writing scripts, you can refer to all objects, except pads, by name, number, or ID. Pads must be referred to by their DOS filename. In the sections below, each method is described. QUALIFYING OBJECTS When referring to objects, you may need to specify where they are in your pad. For example, if you want to change the color of a button, you must specify whether the button is on the page or the background: ________________________________________________________________________ Chapter 1: What's Really Happening 9 ________________________________________________________________________ set the color of page button 1 to red; set the color of background button 1 to red; If you do not specify the whereabouts of a button or field, HyperPAD assumes you want the one on the background. Thus, the following statements refer to the same object: set the color of field 1 to red; set the color of background field 1 to red; When referring to a page, you may need to specify what background the page is on: go to page 1; go to page 1 of background 2; If you do not specify which background a page belongs to, HyperPAD assumes you want the one nearest the front of the pad. For example, "page 1" and "page 1 of background 2" are not necessarily the same page. OBJECT NAMES Although names are optional for all objects except pads, it is usually helpful to give your objects a name that describes their purpose. That way, it's easy to refer to them from within a script. To modify an object name in the Object Info dialog box: 1. Select the Pad, Bkgnd, Page, Button, or Field Info command from the Objects menu. 2. Highlight the Name text box and type in the object's name. 3. Select the << Ok >> button. Once a name is assigned to an object, you can use that name in a script. For example: go to pad "C:\MYPAD.PAD"; set the color to page button "Last Name" to red; put "wow" into page field "Expression"; go to page "Preferences"; go to page "Setup" of background "Options"; Note: When using an object's name in a script, you must enclose it in quotation marks. ________________________________________________________________________ Chapter 1: What's Really Happening 10 ________________________________________________________________________ OBJECT NUMBERS Each object within a pad can be referred to by a number based on its position relative to the other objects in its class. For example, page 1 is the first page in a pad. As you edit your pads by copying, cutting, pasting, and creating pages, the numbers of the pages will change to reflect their new positions. Backgrounds are assigned an object number based on the order of their creation. For example, background 1 was the first background created when you selected New Pad. Background numbers change only if you delete a background from a pad by deleting each page belonging to that background. Buttons and fields are assigned object numbers corresponding to their layer on either the page or background. The object layer closest to the page or to the background is assigned the number 1 (i.e. page field 1, page button 1). As you use the Cut, Copy, Bring Closer and Send Farther commands, the object numbers assigned to the buttons and fields are altered to reflect their new positions. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ **** The Printed Documentation has a picture or screen shot here **** ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Since object numbers change constantly throughout pad creation, using them to refer to objects within a script is not the most reliable method. Determine an object's number by opening the Object Info dialog box for that object. ________________________________________________________________________ Chapter 1: What's Really Happening 11 ________________________________________________________________________ Examples of objects referred to by their number: set the color of page button 1 to red; set the color of field 1 to blue; go to page 137; go to page 3 of background 4; OBJECT ID NUMBERS When an object is created (this includes being copied, pasted and cloned) HyperPAD assigns it a unique identification number. An object's ID number cannot be altered and is never duplicated. Using this number to refer to an object in a script is foolproof because it will never change. You can retrieve an object's ID number by opening the Object Info dialog box. Examples of objects being referenced by their IDs: set the color of page id 5 to red; put "wow" into field id 3; go to page id 45; go to page id 4 of background id 5; go to background id 1; READY TO SCRIPT Now that you have a general introduction to HyperPAD objects, we will introduce you to HyperPAD scripts.